import { S } from '../../s';
import { IPSAppCounterRef } from '../../app/control/ipsapp-counter-ref';
import { IPSAppViewUIAction } from '../../app/view/ipsapp-view-uiaction';
import { IPSDECMUIActionItem } from './ipsdecmuiaction-item';
import { IPSDETBUIActionItem } from './ipsdetbuiaction-item';
import { IPSDEToolbarItem } from './ipsdetoolbar-item';
import { PSDEToolbarItemImpl } from './psdetoolbar-item-impl';
import { IPSLanguageRes } from '../../res/ipslanguage-res';
import { IPSSysImage } from '../../res/ipssys-image';
import { IPSUIAction } from '../../view/ipsuiaction';

export class PSDETBUIActionItemImpl
  extends PSDEToolbarItemImpl
  implements IPSDETBUIActionItem, IPSDECMUIActionItem
{
  get actionLevel(): 50 | 100 | 200 | 250 {
    return this.M.actionLevel != null ? this.M.actionLevel : 100;
  }

  protected cappslanguageres: IPSLanguageRes;
  getCapPSLanguageRes(): IPSLanguageRes | null {
    return (
      this.cappslanguageres ||
      (this.cappslanguageres = this.fillObjectModel(
        S._276,
        this.M.getCapPSLanguageRes,
        S._2a8,
      ) as IPSLanguageRes)
    );
  }

  get groupExtractMode(): 'ITEM' | 'ITEMS' {
    return this.M.groupExtractMode;
  }

  get noPrivDisplayMode(): 1 | 2 | 6 {
    return this.M.noPrivDisplayMode;
  }

  protected psappcounterref: IPSAppCounterRef;
  getPSAppCounterRef(): IPSAppCounterRef | null {
    return (
      this.psappcounterref ||
      (this.psappcounterref = this.fillObjectModel(
        S._9d,
        this.M.getPSAppCounterRef,
        S._2a9,
      ) as IPSAppCounterRef)
    );
  }

  protected psappviewuiaction: IPSAppViewUIAction;
  getPSAppViewUIAction(): IPSAppViewUIAction | null {
    return (
      this.psappviewuiaction ||
      (this.psappviewuiaction = this.fillObjectModel(
        S._8e,
        this.M.getPSAppViewUIAction,
        S._2da,
      ) as IPSAppViewUIAction)
    );
  }

  protected psdetoolbaritems: IPSDEToolbarItem[];
  getPSDEToolbarItems(): IPSDEToolbarItem[] | null {
    return (
      this.psdetoolbaritems ||
      (this.psdetoolbaritems = this.fillChildListModel(
        this.M.getPSDEToolbarItems,
        S._1a1,
      ) as IPSDEToolbarItem[])
    );
  }

  findPSDEToolbarItem(objKey: any): IPSDEToolbarItem | null {
    return this.getPSModel5(
      S._1a1,
      this.getPSDEToolbarItems(),
      objKey,
    ) as IPSDEToolbarItem;
  }

  protected pssysimage: IPSSysImage;
  getPSSysImage(): IPSSysImage | null {
    return (
      this.pssysimage ||
      (this.pssysimage = this.fillObjectModel(
        S._27b,
        this.M.getPSSysImage,
        S._2ad,
      ) as IPSSysImage)
    );
  }

  protected psuiaction: IPSUIAction;
  getPSUIAction(): IPSUIAction | null {
    return (
      this.psuiaction ||
      (this.psuiaction = this.fillObjectModel(
        S._29d,
        this.M.getPSUIAction,
        S._2de,
      ) as IPSUIAction)
    );
  }

  get tooltip(): string {
    return this.M.tooltip;
  }

  protected tooltippslanguageres: IPSLanguageRes;
  getTooltipPSLanguageRes(): IPSLanguageRes | null {
    return (
      this.tooltippslanguageres ||
      (this.tooltippslanguageres = this.fillObjectModel(
        S._276,
        this.M.getTooltipPSLanguageRes,
        S._2c5,
      ) as IPSLanguageRes)
    );
  }

  get uIActionParamJO(): IModel {
    return this.M.uIActionParamJO;
  }

  get uIActionTarget():
    | 'SINGLEDATA'
    | 'SINGLEKEY'
    | 'MULTIDATA'
    | 'MULTIKEY'
    | 'NONE' {
    return this.M.uIActionTarget;
  }

  get xDataControlName(): string {
    return this.M.xDataControlName;
  }

  get enableToggleMode(): boolean {
    return this.M.enableToggleMode != null ? this.M.enableToggleMode : false;
  }

  get hiddenItem(): boolean {
    return this.M.hiddenItem != null ? this.M.hiddenItem : false;
  }

  get saveTargetFirst(): boolean {
    return this.M.saveTargetFirst != null ? this.M.saveTargetFirst : false;
  }

  get valid(): boolean {
    return this.M.valid != null ? this.M.valid : true;
  }
  get cls(): string {
    return 'PSDETBUIActionItemImpl';
  }
  instanceof(cls: string): boolean {
    if (
      cls == S._8e ||
      cls == S._1a8 ||
      cls == S._af ||
      cls == S._1a9 ||
      cls == S._1aa ||
      cls == S._1ab
    )
      return true;
    return super.instanceof(cls);
  }
}
